<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
    <h3 id="myModalLabel">New Employees</h3>
  </div>
 
		<div class="modal-body">
			
			<?if(!empty($n_employee)):?>
				<form class="form-horizontal" action ="<?=site_url('employee/add_nattendance');?>" method="POST">
				<?foreach($n_employee as $ne):?>
					<table class="table table-bordered table-stripped">
						<tbody>
							<tr>
								<td class="span4"><?=ucwords($ne->fullname).' ('.ucwords($ne->position).') ';?></td>
								<td><input type="checkbox" name="new_employees[][emp_id]" value="<?=$ne->emp_id;?>"></td>
							</tr>
						</tbody>
					</table>
				<?endforeach;?>
				<input type="submit" class="btn btn-primary" name="add_nattendance"value="save Changes">
				</form>
			<?else:?>
				<div class="alert alert-info">
					<h4>Notice</h4>
					<p>No New Employees Available.</p>
				</div>
			<?endif;?>
		</div>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
				
		</div>
</div>

<div class="well">
<fieldset>
	<legend>Daily Time Record (IN/OUT)</legend>
	<?=$system_message;?>
	
<?if(!empty($employee)):?>
	<table class="table">
	<thead>
		<tr>
			<?if($employee['status'] == 'has_attendance'):?>
				<th colspan="8"><a href="#myModal" class="btn btn-mini btn-primary" data-toggle="modal" title="Add Newly Added Employees to current DTR"><i class="icon-user"></i> Add New Employees</a></th>
			<?endif;?>
		</tr>
		<tr>
			<th>Employee Name</th>
			<th colspan="2" style="text-align:center;">AM</th>
			<th colspan="2" style="text-align:center;">PM</th>
			<th colspan="2" style="text-align:center;">&nbsp;</th>
			<th colspan="2" style="text-align:center;">Overtime</th>
			
		</tr>
		<tr>
			<th>&nbsp;</th>
			<th style="text-align:center;">In</th>
			<th style="text-align:center;">Out</th>
			<th style="text-align:center;">In</th>
			<th style="text-align:center;">Out</th>
			<th>Absent</th>
			<th>On-Leave</th>
			<th>Rest Day</th>
			<th>Holiday</th>
		</tr>
	</thead>
	<tbody>
		<form action="<?=site_url('employee/attendance');?>" method="post">
		<?foreach($employee['data'] as $e):?>
			<tr>
				<td><?=ucwords($e->fullname);?></td>
				<td style="text-align:center;">
					<div class="input-append bootstrap-timepicker">
						<input type="text" name="attendance[<?=$e->id;?>][am_in]" value="<?=set_value('attendance['.$e->id.'][am_in]',isset($e->am_in)? $e->am_in : NULL);?>" class="timepicker1 input-small">
						<span class="add-on"><i class="icon-time"></i></span>
					</div>
				</td>
				
				<td style="text-align:center;">
					<div class="input-append bootstrap-timepicker">
						<input type="text" name="attendance[<?=$e->id;?>][am_out]" value="<?=set_value('attendance['.$e->id.'][am_out]',isset($e->am_out)? $e->am_out : NULL);?>" class="timepicker1 input-small">
						<span class="add-on"><i class="icon-time"></i></span>
					</div>
				</td>
				
				<td style="text-align:center;">
					<div class="input-append bootstrap-timepicker">
						<input type="text" name="attendance[<?=$e->id;?>][pm_in]" value="<?=set_value('attendance['.$e->id.'][pm_in]',isset($e->am_in)? $e->pm_in : NULL);?>" class="timepicker1 input-small">
						<span class="add-on"><i class="icon-time"></i></span>
					</div>
				</td>
				
				<td style="text-align:center;">
					<div class="input-append bootstrap-timepicker">
						<input type="text" name="attendance[<?=$e->id;?>][pm_out]" value="<?=set_value('attendance['.$e->id.'][pm_out]',isset($e->am_in)? $e->pm_out : NULL);?>" class="timepicker1 input-small">
						<span class="add-on"><i class="icon-time"></i></span>
					</div>
				</td>
				<td>
					<?if(isset($e->absent)  AND $e->absent == 1):?>
						<input type="checkbox" name="attendance[<?=$e->id;?>][absent]" value="1" checked>
					<?else:?>
						<input type="checkbox" name="attendance[<?=$e->id;?>][absent]" value="1">
					<?endif;?>
				</td>
				<td>
					<?if(isset($e->leave)  AND $e->leave == 1):?>
						<input type="checkbox" name="attendance[<?=$e->id;?>][leave]" value="1" checked>
					<?else:?>
						<input type="checkbox" name="attendance[<?=$e->id;?>][leave]" value="1">
					<?endif;?>
				</td>
				<td>
					<?if(isset($e->ot_restday)  AND $e->ot_restday == 1):?>
						<input type="checkbox" name="attendance[<?=$e->id;?>][ot_restday]" value="1" checked>
					<?else:?>
						<input type="checkbox" name="attendance[<?=$e->id;?>][ot_restday]" value="1">
					<?endif;?>
				</td>
				<td>
					<?if(isset($e->ot_holiday)  AND $e->ot_holiday == 1):?>
						<input type="checkbox" name="attendance[<?=$e->id;?>][ot_holiday]" value="1" checked>
					<?else:?>
						<input type="checkbox" name="attendance[<?=$e->id;?>][ot_holiday]" value="1">
					<?endif;?>
				</td>
				<input type="hidden" name="attendance[<?=$e->id;?>][emp_id]" value="<?=$e->id;?>">
				<input type="hidden" name="attendance[<?=$e->id;?>][date]" value="<?=DATE;?>">
			</tr>
		<?endforeach;?>
		<tr>
			<input type="hidden" name="mode" value="<?=$employee['status'];?>">
			<td><input type="submit" name="add_attendance" class="btn btn-success" value="Save Record"></td>
		</tr>
		</form>
	</tbody>
	</table>
	
<?else:?>
	<div class="alert alert-notice">
		No Employee
	</div>
<?endif;?>
<fieldset>
</div>
